package com.lavegue.webaction;


import com.lavegue.common.Constants;
import com.lavegue.common.ListAction;
import com.lavegue.model.BisGroup;
import com.lavegue.model.BisType;
import com.lavegue.service.BisTypeService;

/**
 * author: tinazhifen
 * description:
 *
 */
public class BisTypeAction extends ListAction<BisType> {
	//模板分类Service
	private BisTypeService bisTypeService; 
    private int delId;//删除分类的Id
    private String typeName="";//查询的分类名称字段
 
  //更新的分类名称
    private String updateName;
	private int useUsertypeId;
	private int listTypeId;
	private int pageId;//保留页码
	private int upId;//获取需要更改的分类ID
	    
	//新增的值
	private String addName;
	private int addTypeId;
	private int adduserId;
    
	//管理模块分类，根据分类名称列出所以的模块分类
	public String allBisTypeListByName()
	{
		 if(null==this.getSessionAtrribute(Constants.MAN_SESSION_USER))
		   {
			   return "lg";
		   }
		pageObj=bisTypeService.getAllBisTypeByName(pageNo, pageSize,typeName);
		return "listBisType";
	}
		
	
	//删除模块分类
	public String delBisType()
	{
		BisType bisType=bisTypeService.findById(delId);
		    if(bisType!=null){
		    	bisTypeService.deleteById(delId);
		    }
		return allBisTypeListByName();
	}

    //更新分类	
	public String updateBisGroupType()
	{
		
		BisType bisType=bisTypeService.findById(upId);
		bisType.setName(updateName);
		bisType.setEditAble(listTypeId);
		bisType.setUseUsertype(useUsertypeId);
		bisTypeService.update(bisType);
		pageNo=pageId;
		return allBisTypeListByName();
	}
	
	//新增加分类
	public String addBisType()
	{
		BisType adBisType=new BisType();
		adBisType.setName(addName);
		adBisType.setEditAble(addTypeId);
		adBisType.setUseUsertype(adduserId);
		bisTypeService.save(adBisType);
		return allBisTypeListByName();
	}
	
	
	//根据分类和分类名称查询
	
	public String serachBisGroupType()
	{
		return allBisTypeListByName();
	}


	public BisTypeService getBisTypeService() {
		return bisTypeService;
	}


	public void setBisTypeService(BisTypeService bisTypeService) {
		this.bisTypeService = bisTypeService;
	}


	public int getDelId() {
		return delId;
	}


	public void setDelId(int delId) {
		this.delId = delId;
	}


	public String getTypeName() {
		return typeName;
	}


	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}


	public int getPageId() {
		return pageId;
	}


	public void setPageId(int pageId) {
		this.pageId = pageId;
	}


	public int getUpId() {
		return upId;
	}


	public void setUpId(int upId) {
		this.upId = upId;
	}


	public String getUpdateName() {
		return updateName;
	}


	public void setUpdateName(String updateName) {
		this.updateName = updateName;
	}


	public int getUseUsertypeId() {
		return useUsertypeId;
	}


	public void setUseUsertypeId(int useUsertypeId) {
		this.useUsertypeId = useUsertypeId;
	}


	public int getListTypeId() {
		return listTypeId;
	}


	public void setListTypeId(int listTypeId) {
		this.listTypeId = listTypeId;
	}


	public String getAddName() {
		return addName;
	}


	public void setAddName(String addName) {
		this.addName = addName;
	}


	public int getAddTypeId() {
		return addTypeId;
	}


	public void setAddTypeId(int addTypeId) {
		this.addTypeId = addTypeId;
	}


	public int getAdduserId() {
		return adduserId;
	}


	public void setAdduserId(int adduserId) {
		this.adduserId = adduserId;
	}
	
	
	
	
}

